import {
  appendCommonExceptionCode,
  CustomException,
} from 'src/utils/custom-exception';

export class AuthException extends CustomException<
  keyof typeof AuthExceptionCode
> {}

export const AuthExceptionCode = appendCommonExceptionCode({
  USER_NOT_FOUND: 'USER_NOT_FOUND',
  USER_WORKSPACE_NOT_FOUND: 'USER_WORKSPACE_NOT_FOUND',
  EMAIL_NOT_VERIFIED: 'EMAIL_NOT_VERIFIED',
  CLIENT_NOT_FOUND: 'CLIENT_NOT_FOUND',
  WORKSPACE_NOT_FOUND: 'WORKSPACE_NOT_FOUND',
  INVALID_INPUT: 'INVALID_INPUT',
  FORBIDDEN_EXCEPTION: 'FORBIDDEN_EXCEPTION',
  INSUFFICIENT_SCOPES: 'INSUFFICIENT_SCOPES',
  UNAUTHENTICATED: 'UNAUTHENTICATED',
  INVALID_DATA: 'INVALID_DATA',
  OAUTH_ACCESS_DENIED: 'OAUTH_ACCESS_DENIED',
  SSO_AUTH_FAILED: 'SSO_AUTH_FAILED',
  USE_SSO_AUTH: 'USE_SSO_AUTH',
  SIGNUP_DISABLED: 'SIGNUP_DISABLED',
  GOOGLE_API_AUTH_DISABLED: 'GOOGLE_API_AUTH_DISABLED',
  MICROSOFT_API_AUTH_DISABLED: 'MICROSOFT_API_AUTH_DISABLED',
  MISSING_ENVIRONMENT_VARIABLE: 'MISSING_ENVIRONMENT_VARIABLE',
  INVALID_JWT_TOKEN_TYPE: 'INVALID_JWT_TOKEN_TYPE',
  TWO_FACTOR_AUTHENTICATION_PROVISION_REQUIRED:
    'TWO_FACTOR_AUTHENTICATION_PROVISION_REQUIRED',
  TWO_FACTOR_AUTHENTICATION_VERIFICATION_REQUIRED:
    'TWO_FACTOR_AUTHENTICATION_VERIFICATION_REQUIRED',
  USER_ALREADY_EXISTS: 'USER_ALREADY_EXISTS',
} as const);
